<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>

<html>

<body>
<f:view>
	<f:loadBundle basename="messages" var="msg" />

	<table>
		<tr>
			<td>
			<ul class="list_subsub_kisa">
				<li><a href="mainUserForm.jsf" title="AnaSayfa">Ana Sayfa</a></li>
			</ul>
			</td>

			<td>
			<div class="columnMiddle"><rich:spacer width="1" height="50" />

			<rich:fileUpload id="upload"
				allowFlash="false"
				acceptedTypes="#{fileUploadBean.acceptedTypes}"
				disabled="#{fileUploadBean.disabled}"
				autoclear="#{fileUploadBean.autoclear}"
				required="#{fileUploadBean.required}"
				requiredMessage="#{fileUploadBean.requiredMessage}"
				rendered="#{fileUploadBean.rendered}"
				listHeight="#{fileUploadBean.listHeight}"
				listWidth="#{fileUploadBean.listWidth}"
				fileUploadListener="#{fileUploadBean.fileUploadListener}"
				maxFilesQuantity="#{fileUploadBean.maxFilesQuantity}"
				immediateUpload="#{fileUploadBean.immediateUpdate}"
				addControlLabel="#{fileUploadBean.addControlLabel}"
				clearAllControlLabel="#{fileUploadBean.clearAllControlLabel}"
				clearControlLabel="#{fileUploadBean.clearControlLabel}"
				stopEntryControlLabel="#{fileUploadBean.stopEntryControlLabel}"
				uploadControlLabel="#{fileUploadBean.uploadControlLabel}">

				<a4j:support event="onuploadcomplete" reRender="info" />

			</rich:fileUpload> 
			
			<h:panelGroup id="info">

				<rich:panel>

					<f:facet name="header">

						<h:outputText value="Uploaded Files Info" />

					</f:facet>
					<h:outputText value="No files currently uploaded"
						rendered="#{fileUploadBean.size==0}" />
					<rich:dataGrid columns="1" value="#{fileUploadBean.files}"
						var="file" rowKeyVar="row">

								<a4j:mediaOutput element="pdf" mimeType="application/pdf"
									createContent="#{fileUploadBean.paint}" value="#{row}"
									style="width:100px; height:100px;" />

								<h:panelGrid columns="2">

									<h:outputText value="File Name:" />

									<h:outputText value="#{file.name}" />

									<h:outputText value="File Length(bytes):" />

									<h:outputText value="#{file.length}" />

								</h:panelGrid>

					</rich:dataGrid>

				</rich:panel>
				<rich:spacer height="3" />
				<br />

				<a4j:commandButton action="#{fileUploadBean.clearUploadData}"
					reRender="info, upload" value="Clear Uploaded Data"
					rendered="#{fileUploadBean.size>0}" />
			</h:panelGroup> 
			</div>
			</td>
		</tr>
	</table>

</f:view>

</body>
</html>
